<!--
 * @Descripttion:
 * @version:
 * @Author: zhuzm@linkstec.com
 * @Date: 2023-01-09 15:01:06
 * @LastEditors: sueRimn
 * @LastEditTime: 2023-03-14 17:26:34
-->
<template>
  <div class="search-list-report">
    <div class="list-item" v-for="(item, index) in dataFilter" :key="index">
      <h2 class="name" v-html="item.title_v" @click="goDetail(item)"></h2>
    </div>
  </div>
</template>
<script>
import { verifyRoles } from '@/utils/verify';
export default {
  props: {
    data: {
      type: Array,
      default: () => {
        return [];
      }
    },
    max: {
      type: Number,
      default: Infinity
    }
  },
  computed: {
    dataFilter () {
      if (this.max === Infinity) return this.data;
      return this.data.slice(0, this.max);
    }
  },
  methods: {
    goDetail (item) {
      const judge = verifyRoles('GTJA', 0);
      if (!judge) {
        return;
      }
      const id = item.id || item.reportId;
      if (item.reportType == 'xst') {
        window.location.href = process.env.VUE_APP_SERVICE_CP_NEWPREPORTDETAILS + '\\' + id;
      } else {
        window.location.href = process.env.VUE_APP_SERVICE_CP_PREPORTDETAILS + '\\' + id;
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.search-list-report{
  .list-item{
    margin-bottom: 11px;
    display: flex;
    .code{
      font-size: 14px;
      color: #333333;
      margin-right: 8px;
    }
    .name{
      font-size: 14px;
      color: #333333;
      font-weight: 400;
      cursor: pointer;
    }
    &:hover {
      .name,.code{
        color: #2468F2;
        ::v-deep .search-highlight {
          color: #2468F2;
        }
      }
    }
    .code,.name{
      display: flex;
      align-items: center;
      &::v-deep .search-highlight {
        color: #FE5D5B;
      }
    }
  }
}
</style>
